<template>
  <el-table :height="calTableHeight() - 50" show-summary :summary-method="handleSum" ref="TableRef" :data="data">
    <el-table-column type="index" :label="$t('序号')" width="60" align="center" />
    <el-table-column show-overflow-tooltip :label="$t('卖家')" align="center" prop="sellerName" />
    <el-table-column show-overflow-tooltip :label="$t('订单号')" align="center" prop="orderNo" />
    <el-table-column show-overflow-tooltip :label="$t('包裹号')" align="center" prop="packageNo" />
    <el-table-column show-overflow-tooltip :label="$t('运费')" align="center" prop="freightFee">
      <template #default="{ row }">
        <div>{{ row.freightFee | thousand }}</div>
      </template>
    </el-table-column>
    <el-table-column show-overflow-tooltip :label="$t('包过费')" align="center" prop="baleFee">
      <template #default="{ row }">
        <div>{{ row.baleFee | thousand }}</div>
      </template>
    </el-table-column>
    <el-table-column show-overflow-tooltip :label="$t('总价')" align="center" prop="totalFee">
      <template #default="{ row }">
        <div>{{ row.totalFee | thousand }}</div>
      </template>
    </el-table-column>
    <el-table-column show-overflow-tooltip :label="$t('类型')" align="center" prop="">承担</el-table-column>
  </el-table>
</template>
<script>
import handleTableSum from '@/utils/handleSum'

export default {
  activated() {
    this.$nextTick(() => this.$refs['TableRef']?.doLayout())
  },
  props: {
    /**
     * data
     */
    data: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {}
  },
  methods: {
    handleSum(param) {
      /**
       * 需要进行统计的字段
       */
      const data = handleTableSum(param, ['totalFee'], '合计', 0)
      console.log(`data ==>`, JSON.parse(JSON.stringify(data)))
      return data
    },

    cancel() {
      this.$emit('update:show', false)
    },
  },
}
</script>
